package com.yuxi.Dao.Impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.yuxi.Dao.UserStructureDao;
import com.yuxi.Entity.UserStructure;

@Repository
public class UserStructureDaoImpl extends BaseDaoImpl<Serializable, Serializable> implements UserStructureDao {

	@Override
	public UserStructure getStructureByUserId(Integer userId) {
		List rs=super.find("from UserStructure where userId=?",userId );
		if(rs.size()>=1&&rs!=null){
			return (UserStructure)rs.get(0);
		}else{
			return null;
		}		
	}

	@Override
	public List<UserStructure> getStructureUserByStructureId(Integer structureId) {
		List<UserStructure> uStructures = super.find("from UserStructure where StructureId=?",structureId );
		return uStructures;
	}

	@Override
	public void addUserStructure(UserStructure uStructure) {
		 super.add(uStructure);
	}

	@Override
	public void modifyUserStructure(UserStructure uStructure) {
		 super.update(uStructure);
	}

}
